﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ArtClub.DBAL;
using ArtClub.Controller;


namespace ArtClub.View
{
    public partial class LoginPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            MemberCtr mCtr = new MemberCtr();
            int value = mCtr.logIn(TextBox1.Text, TextBox2.Text);
            if (value == 1)
            {
                //Member m = mCtr.getMemberByUsername(TextBox1.Text, TextBox2.Text);
                AppSession.member.userId = 2;
                AppSession.member.userName = "kitty";
                AppSession.member.passWord = "12345";
                AppSession.member.Save();
                Response.Redirect("BrowseCatalogue.aspx");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "dwre", "bootbox.alert('Login failed, user name or password is wrong.')", true);
            }
        }
    }
}